<template>
	<div class="BiSpectaculars">
		<header><i class="iconfont icon-xiangzuo1" @click="goprev"></i><span>卸货预警</span></header>
        <div class="select-main">
            <div class="select-item">
                <p style="margin-right: 10px">仓库:</p>
                <el-select v-model="consignes" placeholder="请选择仓库" size="mini" @change="getShowList" filterable style="width: 84%" clearable :remote-method="getConsignesList">
                    <el-option v-for="item in consignesList" :key="item.address" :label="item.shortName" :value="item.id"></el-option>
                </el-select>
            </div>
            <div class="select-item">
                <p style="margin-right: 10px">车牌:</p>
                <el-select v-model="vehicleNo" placeholder="请选择车牌" size="mini" @change="getShowList" :remote="true" style="width: 84%" clearable filterable :remote-method="getVehicleList">
                    <el-option v-for="item in vehicleList" :key="item.vehicleNo" :label="item.vehicleNo" :value="item.vehicleNo"></el-option>
                </el-select>
            </div>
            <div class="select-item">
                <p style="margin-right: 10px">排序:</p>
                <el-select v-model="sortType" placeholder="请选择车牌" size="mini" style="width: 84%" @change="changeSort" clearable filterable>
                    <el-option label="时间" value="time"></el-option>
                    <el-option label="仓库" value="cangku"></el-option>
                </el-select>
            </div>
        </div>
		<!-- 页面数据为空时 -->
        <div class="main-body"> 
            <div class="forewarning" 
                v-for="(item, index) in list"
                :key="index">
            <div class="title">
                <div style="overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{item.shortName}}</div>
                <div>{{item.code}}</div>
            </div>
            <div style="display: flex; justify-content: space-between">
                <div>车牌号：{{item.vehicleCode}}</div>
                <div>司机姓名： {{item.driverName}}</div>
            </div>
            <div>司机电话： {{item.mobileNumber}}</div>
            <div style="display: flex; justify-content: space-between">
                <div>本仓重量： {{item.weight}} KG</div>
                <div>剩余总重量： {{item.plusTotalWt}} KG</div>
            </div>
            <div v-if="item.mimnute > 300" class="leve1">已等待 {{Math.floor(item.mimnute / 60)}}小时{{item.mimnute % 60}}分钟</div>
            <div v-else class="leve2">已等待 {{Math.floor(item.mimnute / 60)}}小时{{item.mimnute % 60}}分钟</div>
            </div> 
        </div>
	</div>
</template>
<script type="text/javascript">
	import * as fetchObj from '@/api/index/exceptionList';
	export default {
		name: 'BiSpectaculars',
		data() {
			return {  
                setIntervalTime: null,
                timer: null,
                list: [],
                token:'',
                consignes: '',
                consignesName: '',
                vehicleNo: '',
                vehicleList: [],
                consignesList: [],
                show: false,
                sortType: 'time',
			}
		},
		mounted() {},
		created() {
            this.getShowList()
            this.getConsignesList('')
            this.getVehicleList('')
		},
		methods: {
		    changeSort (val) {
                this.sortType = val
                this.getShowList()
            },
            getShowList () {
                if (this.consignes) {
                    this.consignesName = this.consignesList.filter(item => item.id == this.consignes)[0].shortName
                } else {
                    this.consignesName = ''
                }
                let params = {
                    vehicleCode: this.vehicleNo,
                    tjOrgnizationId: this.consignes,
                    sortType: this.sortType
                }
                this.show = false
                let that = this
                this.httpRequest1('post', '/system/shipment/queryWarnShipmentRoute', params).then(res => {
                    that.list = res.data
                })
            },
            getVehicleList (vehicleNo) { 
                let params = {
                    vehicleNo: vehicleNo
                }
                let that = this
                this.httpRequest1('post', '/system/vehicleMaster/queryVehicleMasterApp', params).then(res => {
                    that.vehicleList = res.data.list
                })
            },
            getConsignesList (address) {
                let params = {
                    address: address
                }
                let that = this
                
                this.httpRequest1('post', '/system/orgnization/getCangKuList', params).then(res => {
                    that.consignesList = res.data
                })
            },
			// 返回上一页
			goprev() {
				this.$router.push({
					name: 'Index',
				})
			},
		}
	}

</script>
<style lang="less" scoped>
@import "../../components/publicLess.less";
.BiSpectaculars {
    min-height: 100vh;
    background: #081B56;
    .query-main {
        padding-top: 60px;
        border-bottom: 0.3vh solid #0344AB;
        display: flex;
        justify-content: space-around;
        font-size: 16px;
        color: #fff;
        div {
            margin-right: 20px;
        }
    }
    .select-main {
        padding-top: 60px;
        // display: flex;
        font-size: 16px;
        color: #fff;
        .select-item { 
            display: flex;
            padding-left: 20px;
            border-bottom: 0.3vh solid #0344AB;
            margin-bottom: 10px;
            line-height: 30px;
            
        }
    }
    .main-body {
        font-size: 16px;
        color: #fff;
        margin-top: 1vh;
        .forewarning {
        color: #fff; 
        border: 2px solid #0344AB;
        padding: 10px;
        background-color: #040F2D; 
        margin-right: 2%;
        margin-left: 2%;
        margin-bottom: 10px; 
            .title {
                font-size: 24px;
                margin-bottom: 5px; 
                border-bottom: 2px solid #0344AB;
            } 
            .leve1 {
                background: #F56C6C;
                text-align: center;
                margin-top: 5px;
                font-size: 16px;
            }
            .leve2 {
                background: #E6A23C;
                text-align: center;
                margin-top: 5px;
                font-size: 16px;
            }
        } 
    }
}
/deep/ .el-input--mini .el-input__inner {
    background: #081B56 !important;
    border-color: #081B56 !important;
    color: #fff;
    font-size: 16px;
}
</style>